package com.kexio.email.enums;

/**
 * 邮件类型枚举
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
public enum EmailType {
    
    /**
     * 纯文本邮件
     */
    TEXT("text", "纯文本邮件"),
    
    /**
     * HTML邮件
     */
    HTML("html", "HTML邮件"),
    
    /**
     * 模板邮件
     */
    TEMPLATE("template", "模板邮件"),
    
    /**
     * 富文本邮件 (包含附件)
     */
    RICH("rich", "富文本邮件");
    
    private final String code;
    private final String description;
    
    EmailType(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static EmailType fromCode(String code) {
        for (EmailType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown email type code: " + code);
    }
}
